<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			function sortnum(x,y){
				return x-y;//从小到大
				//return y-x;//从大到小
			}
			
			var arr=[0,5,2,3,4,9,8,7,1,6];
			var re=arr.sort(sortnum);
			document.write(re);
		</script>
	</head>
	<body>
	</body>
</html>
